/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package business.Imp;

import business.Service.UserService;
import data.Imp.FriendListServiceDAOImp;
import data.Imp.PostServiceDAOImp;
import java.util.List;
import data.Imp.UserServiceDAOImp;
import data.Services.FriendListDAOService;
import data.Services.PostDAOService;
import data.Services.UserDAOService;
import model.entity.User;

/**
 *
 * @author quanhungbang
 */
public class UserServiceImpl implements UserService{
    UserDAOService uds = new UserServiceDAOImp();
    PostDAOService pds = new PostServiceDAOImp();
    FriendListDAOService fls = new FriendListServiceDAOImp();

    @Override
    public List<User> getAllUser() {
        return uds.getAllUser();
    }

    @Override
    public User getUserByID(int id) {
        return uds.getUserByID(id);
    }

    @Override
    public User getUserByEmail(String email) {
        return uds.getUserByEmail(email);
    }

    @Override
    public List<User> findUserByUserName(String fullname) {
        return uds.findUserByUserName(fullname);
    }

    @Override
    public List<User> findUserByRole(int roleID) {
        return uds.findUserByRole(roleID);
    }

    @Override
    public boolean createUser(User user) {
        return uds.createUser(user);
    }

    @Override
    public boolean updateProfile(User user) {
        return uds.updateProfile(user);
    }

    @Override
    public boolean updatePassword(User user) {
        return uds.updatePassword(user);
    }

    @Override
    public boolean updatePassword(int user_id, String password) {
        return uds.updatePassword(user_id, password);
    }

    @Override
    public boolean updateUserByAdmin(User user) {
        return uds.updateUserByAdmin(user);
    }

    @Override
    public boolean deleteUser(int userID) {
        return (uds.deleteUser(userID) && pds.deletePostbyUserID(userID)&&fls.deleteFriendListByUser(userID));
    }

    @Override
    public boolean activeAccount(String name, String activeCode) {
        return uds.activeAccount(name, activeCode);
    }

    @Override
    public int getRegisterId(User user) {
        return uds.getRegisterId(user);
    }

    @Override
    public boolean updateStatus(String email, int status) {
        return uds.updateStatus(email, status);
    }

    @Override
    public boolean restoreUser(int userID) {
        return uds.restoreUser(userID);
    }
    
}
